package com.woniuxy.purchasemanager.controller;

import com.woniuxy.purchasemanager.service.PurchaseOrderFileService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName PurchaseOrderController
 * @Description 文件下载控制器
 * @Author xianhao
 * @Date 2022/4/20 11:00
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/file")
public class PurchaseOrderFileController {

    @Resource
    private PurchaseOrderFileService purchaseOrderFileService;

    /**
     * 这种代码别写了
     * 导出需要指定你的ContentType string又当成会json转给前端
     * contentType冲突
     * @param response
     * @return
     */
    @GetMapping("/purchaseOrder/export")
    public String exportDataToExcel(HttpServletResponse response){
        purchaseOrderFileService.exportDataToExcel(response);
        return "导出成功！";
    }
}
